<?php $this->context->layout = 'form'; ?>
    <style>
        legend {
            width: auto !important;
            border-style: none !important;
        }

        body {
            font-size: initial;
        }
    </style>
    <div class="layui-card-body">
        <!--基本信息-->
        <form class="form-horizontal m" id="form-config-add">


            <div>
                <input type="hidden" name="id" value="<?= $data['id'] ?>">
                <div class="layui-form-item">
                    <fieldset class="layui-elem-field layui-field-title">
                        <legend>收货信息</legend>
                    </fieldset>
                </div>
                <div class="layui-form-item div-flex">
                    <div class="row row-no-gutters">
                        <div class="col-xs-4">收货人：<?= $data['consignee'] ?></div>
                        <div class="col-xs-4">手机号：<?= $data['mobile'] ?></div>
                        <div class="col-xs-4">
                            收货地址：<?= $data['province'] . $data['city'] . $data['district'] . $data['address'] ?></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <fieldset class="layui-elem-field layui-field-title">
                        <legend>商品信息</legend>
                    </fieldset>
                </div>

                <div class="layui-form-item table-margin">
                    <table class="layui-table">

                        <thead>
                        <tr>
                            <th>商品订单编号</th>
                            <th>商品信息</th>
                            <th>价格(元)</th>
                            <th>数量</th>
                            <th>小计(元)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach ($data['goods'] as $good):?>
                            <tr>
                                <td><?=$good['good_id']?></td>
                                <td>
                                    <div style="text-align: left">
                                        <div class="layui-col-md5">
                                            <img src="<?=$good['good_info_arr']['main_img']?>" class="image-show image">
                                        </div>
                                        <div class="layui-col-md5">
                                            <p style="margin-top: 10px"><?=$good['good_name']?></p>
                                            <br>
                                            <p><?=$good['spec_name']?></p>
                                        </div>
                                    </div>
                                </td>
                                <td>￥<?=$good['good_price']?></td>
                                <td><?=$good['good_num']?></td>
                                <td><?=$good['good_price']?></td>
                            </tr>
                        <?php endforeach;?>
                        <tr>
                            <td colspan="4"></td>
                            <td style="text-align: left">
                                <p>商品金额:￥<?=$data['total_amount']?></p>
                                <p>运费金额:￥<?=$data['freight']?></p>
                                <p style="color: red">优惠金额:￥<?=$data['discount_amount']?></p>
                                <p>应付金额:￥<?=$data['pay_amount']?></p>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item">
                    <fieldset class="layui-elem-field layui-field-title">
                        <legend>快递信息</legend>
                    </fieldset>
                </div>
                <div class="row">
                    <div class="form-group mb0">
                        <label class="col-sm-3 control-label is-required">快递类型：</label>
                        <div class="col-sm-3 mb15">
                            <?= \common\widgets\FormInput::widget(['name' => 'select', 'extend' => ['name' => 'express_type', 'place' => '请选择快递', 'data' => $expressType, 'class' => 'form-control', 'required' => 1]]) ?>
                        </div>
                    </div>
                    <?= \common\widgets\FormInput::widget(['name' => 'forminput|快递单号', 'extend' => ['name' => 'express_sn', 'required' => 1]]) ?>
                </div>
            </div>
        </form>
    </div>
<?php $this->beginBlock('script'); ?>
    <script>
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save('<?=\yii\helpers\Url::to(['deliver'])?>', $('#form-config-add').serialize());
            }
        }
    </script>
<?php $this->endBlock(); ?>